<?php

namespace admin\controllers;

use app\models\Banner;
use admin\components\BaseAuthController;

class BannerController extends BaseAuthController{

    public $name = '广告图管理';

    public function actionIndex(){
        $model = new Banner();
        $model->pageSize = FALSE;
        $dataProvider = $model->search();
        return $this->render(compact('dataProvider'));
    }

    public function actionSave($id = false){
        /* @var $model Banner */
        $model = $this->findModel($id, Banner::className());
        if (!$model->load($this->post())) {
            return $this->render(compact('model'));
        }
        return $model->save();
    }
}
